<%@page import="monster.comm.util.SpringApplicationContextFactory"%>
<%@page import="monster.flight.admin.manager.service.admin.Flight_infoService"%>
<%@page import="monster.flight.comm.util.FlightFactory"%>
<%@page import="monster.comm.util.DateUtil"%>
<%@page import="monster.flight.comm.entity.vo.FlightBay"%>
<%@page import="sun.jdbc.rowset.CachedRowSet"%>
<%@page import="monster.flight.comm.entity.vo.Flight_info"%>
<%@page import="monster.comm.database.DBManager"%>
<%@page import="monster.comm.util.SysConstant"%>
<%@page import="monster.comm.util.UserService"%>
<%@page import="monster.comm.util.Tool"%>
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%@page import="java.net.URLEncoder"%>
<%@page import="java.net.URLDecoder"%>
<%
String admin=Tool.getRequest("admin",request);//必传参数
String adminpassword=Tool.getRequest("adminpassword",request);//必传参数
admin= URLDecoder.decode(admin, "utf-8");
if(admin.length()==0){
	out.println("{\"id\":-101,\"name\":\"你还没有输入name！\"}");
	return;
}
String list="";
String flight_date = DateUtil.getDate("yyyy-MM-dd");
UserService user = (UserService) session.getAttribute(SysConstant.SESSION_NAME);//获得session里面的登陆信息
if(1==2){
	out.println("{\"id\":-100,\"name\":\"没有登录\"}");
	return;
}else{
	try{
		DBManager db = new DBManager();
	
		String sql = "select STAFF_NAME,STAFF_SN,STAFF_ID from STAFF_INFO where STAFF_NAME='"+admin+"' and password='"+adminpassword+"' and is_admin='1'";					
		CachedRowSet cr = db.getRowSet(sql);
		String SQUADRON_NO="";
		if(cr.next()){	
			SQUADRON_NO="1";
			list="{\"id\":100}";
			String STAFF_NAME=Tool.getRsValue(cr,"STAFF_NAME");
			String STAFF_SN=Tool.getRsValue(cr,"STAFF_SN");
			String STAFF_ID=Tool.getRsValue(cr,"STAFF_ID");
			session.setAttribute("STAFF_NAME",STAFF_NAME);
			session.setAttribute("STAFF_SN",STAFF_SN);
			session.setAttribute("STAFF_ID",STAFF_ID);
		}
		if("".equals(SQUADRON_NO)){
			list="{\"id\":101}";
		}
	}catch(Exception e){
		 e.printStackTrace();
		 list="{\"id\":-200,\"name\":\"程序异常\"}";
	}
	
	out.println(list);

}
%>
